import { S } from '../s';
import { IPSAppDEACMode } from '../app/dataentity/ipsapp-deacmode';
import { IPSAppDEDataSet } from '../app/dataentity/ipsapp-dedata-set';
import { IPSAppDataEntity } from '../app/dataentity/ipsapp-data-entity';
import { IPSEditorItem } from './ipseditor-item';
import { IPSNavigateContext } from './ipsnavigate-context';
import { IPSNavigateParam } from './ipsnavigate-param';
import { IPSNavigateParamContainer } from './ipsnavigate-param-container';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSEditorItemImpl
  extends PSModelObjectImpl
  implements IPSEditorItem, IPSNavigateParamContainer
{
  protected psappdeacmode: IPSAppDEACMode;
  getPSAppDEACMode(): IPSAppDEACMode | null {
    if (this.psappdeacmode != null) return this.psappdeacmode;
    const value = this.M.getPSAppDEACMode;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdeacmode = ipsappdataentity.findPSAppDEACMode(value);
    }
    return this.psappdeacmode;
  }

  protected psappdedataset: IPSAppDEDataSet;
  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  protected psappdataentity: IPSAppDataEntity;
  getPSAppDataEntity(): IPSAppDataEntity | null {
    return (
      this.psappdataentity ||
      (this.psappdataentity = this.fillObjectModel(
        S._f,
        this.M.getPSAppDataEntity,
        S._2aa,
      ) as IPSAppDataEntity)
    );
  }

  protected psnavigatecontexts: IPSNavigateContext[];
  getPSNavigateContexts(): IPSNavigateContext[] | null {
    return (
      this.psnavigatecontexts ||
      (this.psnavigatecontexts = this.fillChildListModel(
        this.M.getPSNavigateContexts,
        S._8c,
      ) as IPSNavigateContext[])
    );
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5(
      S._8c,
      this.getPSNavigateContexts(),
      objKey,
    ) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[];
  getPSNavigateParams(): IPSNavigateParam[] | null {
    return (
      this.psnavigateparams ||
      (this.psnavigateparams = this.fillChildListModel(
        this.M.getPSNavigateParams,
        S._8a,
      ) as IPSNavigateParam[])
    );
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5(
      S._8a,
      this.getPSNavigateParams(),
      objKey,
    ) as IPSNavigateParam;
  }
  get cls(): string {
    return 'PSEditorItemImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._3de || cls == S._7) return true;
    return super.instanceof(cls);
  }
}
